#ifndef _GAME_H
#define _GAME_H

#ifdef _WIN32
#include <windows.h>
#endif

#include <list>
#include <boost/date_time/posix_time/posix_time.hpp>

#include "Scene.h"
#include "WaveInfo.h"

class Background;
class HUD;
class PauseScreen;
class RedBirdFactory;
class YellowBirdFactory;
class BoomerangBirdFactory;
class AudioSource;
class Blade;

enum GameMode 
{
    ARCADE,
    SURVIVAL
};

class Game : public Scene
{
public:
    Game(MyWindow* window, const GameMode mode);
    virtual ~Game();

    bool init();
    void prepare(float dt);
    void render();
    void shutdown();

    void onResize(int width, int height);

    float getElapsedTime(void) const { return m_elapsedTime; }
    float getRemainingTime(void) const { return m_remainingTime; }
    int getScore(void) const { return m_score; }
    GameMode getGameMode(void) const { return m_gameMode; }
    int getLifes(void) const { return m_lifes; }
    int getCombo(void) const { return m_combo; }

    void increaseScore(const int delta);
    void decreaseScore(const int delta);

    bool isEntityBladed(const Vector3& position, const Dimension& size) const;

    void decreaseLifes(const int num = 1);

private:
    GameMode m_gameMode;
    int m_lifes;
    Background* m_background;
    HUD* m_hud;
    PauseScreen* m_pauseScreen;
    float m_elapsedTime;
    float m_remainingTime;
    bool m_isGamePaused;
    int m_score;
    RedBirdFactory* m_redBirdFactory;
    YellowBirdFactory* m_yellowBirdFactory;
    BoomerangBirdFactory* m_boomerangBirdFactory;
    std::list<WaveInfo> m_waveList;
    AudioSource* m_bgm;
    Blade* m_blade;
    int m_combo;
    boost::posix_time::ptime m_timeLastExplosion;

    void processWave(void);

};

#endif
